<?php defined('SEJUJOPEFDNGJSL') or exit('Access denied');?>
<?php
if(!isset($_GET['templist'])){
	$now_price=getprice();
    
?>
    <?php require("topbut.php") ?>
    <div class="panel panel-inverse">
        <div class="panel-heading">
            <div class="row">
                <div class="col-md-12">
                    <h4 class="panel-title" style="float: left;">转换商品积分</h4>
                    <a href="<?php echo $GLOBALARR['curl']?>&templist=1" style="color: #fff;float: right;">查看转换记录</a>
                </div>
            </div>
        </div>
        <div class="panel-body">
            <form action="control.php" method="post" onsubmit="return chktranscoin()"  class="form-horizontal">
                <div class="table-responsive">
                        <table class="table table-striped givetable">
                            <tr>
                            <!--
                                <th><span style="color:#dd1c21;">每日可兑上限</span></th>
                                <th><span style="color:#dd1c21;">今日已兑金额</span></th>
                                <th><span style="color:#dd1c21;">当前美业币价格</span></th>
                                <th><span style="color:#dd1c21;">赠送积分</span></th>
                                -->
                                <th><span style="color:#dd1c21;">奖励积分</span></th>
                                <th><span style="color:#dd1c21;">分享积分</span></th>
                                <th><span style="color:#dd1c21;">晋级包</span></th>
                                <!--
                                <th><span style="color:#dd1c21;">赠送积分兑换数</span></th>
                                <th><span style="color:#dd1c21;">静态钱包兑换数</span></th>
                                <th><span style="color:#dd1c21;">动态钱包兑换数</span></th>
                                <th><span style="color:#dd1c21;">晋级钱包兑换数</span></th>
                                -->
                            </tr>
                 
                            <tr>
                            <!--
                                <td><span style="color:#dd1c21;">￥<?php echo $GLOBALARR['qkmax']; ?></span></td>
                                <td><span style="color:#dd1c21;">￥<?php echo $tnum;?></span></td>
                                <td><span style="color:#dd1c21;">￥<?php echo $now_price ?></span></td>
                                <td><span style="color:#dd1c21;">￥<?php echo $r['fuxiao_crash']?></span></td>
                                -->
                                <td><span style="color:#dd1c21;">￥<?php echo $r['lixi_crash']?></span></td>
                                <td><span style="color:#dd1c21;">￥<?php echo $r['cash_ldprize'];?></span></td>
                                <td><span style="color:#dd1c21;">￥<?php echo $r['rise_crash']?></span></td>
                                <!--
                                <td><span style="color:#dd1c21;"><?php echo floor($bjnum*100)/100;?></span></td>
                                <td><span style="color:#dd1c21;"><?php echo floor($lxnum*100)/100;?></span></td>
                                <td><span style="color:#dd1c21;"><?php echo floor($ldnum*100)/100;?></span></td>
                                <td><span style="color:#dd1c21;"><?php echo floor($rnum*100)/100;?></span></td>
                                -->
                            </tr>
                        </table>
                    </div>
                <input type="hidden" name="act" value="transcoin" />
                <input type="hidden" name="sprice" value="<?php echo $now_price; ?>" />
                <fieldset style="border:none;">
                    


                    
                    <div class="form-group">
                        <label for="exampleInputEmail1" class="col-md-3 control-label ui-sortable">转换数量</label>
                        <div class="col-md-9 ui-sortable">
                            <input type="text" name="num" id="num" value="" class="form-control" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="exampleInputEmail1" class="col-md-3 control-label ui-sortable">转换类型</label>
                        <div class="col-md-9 ui-sortable">
                            <select class="form-control" name="ztype" id="ztype" >
                                <option value="-1">请选择转换类型</option>
                                <option value="1">奖励积分</option>
                                <option value="2">分享积分</option>
                                <option value="3">晋级包</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="exampleInputEmail1" class="col-md-3 control-label ui-sortable">交易密码</label>
                        <div class="col-md-9 ui-sortable">
                            <input type="password" name="pwd" id="pwd" value="" class="form-control"  />
                            <span style="color:red;" id="ztxt"></span>
                            <span style="display:none;" id="did"></span>
                        </div>
                    </div>
                 
                  
                    <div class="form-group">
                        <div class="col-md-4 col-md-offset-3 ui-sortable">
                            <button type="submit" class="btn btn-md btn-success m-r-5">提交</button>
                        </div>
                    </div>
                </fieldset>
			</form>
		</div>
	</div>
    <script type="text/javascript" src="/public/home/js/layer/layer.js"></script>
	
<?php
}
elseif($_GET['templist']==1){
	$qbtype=array(0=>'赠送积分',1=>'奖励积分',2=>'分享积分',3=>'晋级包');
?>
<?php require("topbut.php") ?>
    <div class="panel panel-inverse">
        <div class="panel-heading">
            <div class="row">
                <div class="col-md-12">
                    <h4 class="panel-title" style="float: left;">我的转换记录</h4>
                    <a href="home.php?lsact=tranelecoin" style="color:#fff;float: right;">返回</a>
                </div>
            </div>
        </div>
        <div class="panel-body">
			<div class="table-responsive">
				<table class="table table-striped givetable">
				  <tbody>
					<tr>
						<th>序号</th>
						<th>转换类型</th>
						<th>转换数量</th>
						<th>手续费</th>
                        <th>实际转换数量</th>
						<th>转换时间</th>
						
					</tr>
	<?php
    $pagecount=10;
    $condition=" where tuid= ".$_userid;
    $psql="select count(0) from ld_trans_elecoin $condition";
    $db->query($psql,3);
    $pcount=$db->fval;
    $pagecount=$pagecount;   //每页条数
    $astr="&lsact=tranelecoin&templist=1";    //Url
    $pagearr=pagelist($pagecount,$pcount,$astr);
    $offset=$pagearr[1];
    $sql="select * from ld_trans_elecoin $condition order by id desc limit $offset,$pagecount";
    $db->query($sql);
    $rs=$db->rs;
    $ii=0;    
    $type=array("","奖励积分","分享积分","晋级包");
	foreach ($rs as $k => $v) {
	  $ii++;
	?>
		<tr>
			<td align="center"><?php echo $ii;?></td>
			<td align="center"><?php echo $type[$v['ttype']];?></td>
			<td align="center"><?php echo $v['tnum'];?></td>
			<td align="center"><?php echo round($v['tfee'],2);?>%</td>
            <td align="center"><?php echo $v['tsjnum'];?></td>
			<td align="center"><?php echo formatdate($v['ttime'])?></td>
           
		</tr>
	<?php
	}
	?>
				  </tbody>
                </table>
            </div>
        </div>
	</div>
<?php if(($pcount/$pagecount)>1){?>
<div class="pagediv"><?php echo $pagearr[0]?></div>
<?php }?>
<?php if($pcount==0){?>
<div class="pagediv" style="text-align:center;color:#E47501">--> 暂无数据</div>

<?php
} 
}

?>